package com.hjf.booking.module.record.controller;

import com.hjf.booking.constants.BaseResponse;
import com.hjf.booking.module.record.po.ConsumeRecord;
import com.hjf.booking.module.record.service.ConsumeRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.*;

import java.util.Date;

/**
 * @author hjf
 * @date 2021-02-22 9:56
 */
@RestController
@RequestMapping("/record")
public class ConsumeRecordController {

    @Autowired
    private ConsumeRecordService consumeRecordService;

    @PostMapping("/add")
    public BaseResponse record(@RequestBody ConsumeRecord consumeRecord){

        return consumeRecordService.record(consumeRecord);
    }

    @GetMapping("/day/report")
    public BaseResponse dayReport(@RequestParam("reportDate")
                                  @DateTimeFormat(pattern = "yyyy-MM-dd")
                                  Date reportDate){
        return consumeRecordService.dayReport(reportDate);
    }

    @GetMapping("/list")
    public BaseResponse list(){
//        return consumeRecordService.list()
        return null;
    }
}
